From f5d749a1d50efe1308f4490246974f8d7755b6d5 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Wed, 31 Jul 2024 12:56:28 -0500 Subject: [PATCH] auth_parts.mak is not needed now that template inheritance is corrected --- src/pgwui_common/templates/auth_base.mak | 70 ++++++++++++++++-- src/pgwui_common/templates/auth_parts.mak | 90 ----------------------- 2 files changed, 63 insertions(+), 97 deletions(-) delete mode 100644 src/pgwui_common/templates/auth_parts.mak diff --git a/src/pgwui_common/templates/auth_base.mak b/src/pgwui_common/templates/auth_base.mak index cea9f36..0245964 100644 --- a/src/pgwui_common/templates/auth_base.mak +++ b/src/pgwui_common/templates/auth_base.mak @@ -57,7 +57,6 @@ import attrs errors_base_mak = asset_abspath('pgwui_common:templates/errors_base.mak') - auth_parts_mak = asset_abspath('pgwui_common:templates/auth_parts.mak') lib_mak = asset_abspath('pgwui_common:templates/lib.mak') @attrs.define @@ -69,9 +68,6 @@ %> <%inherit file="${errors_base_mak}" /> -<%namespace file="${auth_parts_mak}" - name="auth_parts" - inheritable="True" /> <%namespace name="lib" file="${lib_mak}" /> <%def name="navbar_content()"> @@ -82,15 +78,75 @@ +<%def name="hidden_vars(csrf_token)"> + + + % if db_changed is not None and db_changed is not UNDEFINED: + <%doc>This is a hack. It should be fixed so that only double-upload + detecting forms unconditionally generate this element. + + % endif + + <%doc> All the *_row() defs take a tab_index and, as a side effect, increment the tab_index with the number of rows added to the table. +<%def name="user_row(tab_index, havecreds, user)"> + + + + + + % if havecreds: + ${user} + % else: + + % endif + <% tab_index.inc() %> + + + + +<%def name="password_row(tab_index, havecreds)"> + % if not havecreds: + + + + + + + + + <% tab_index.inc() %> + % endif + + <%def name="main_form(tab_index)">
- ${self.auth_parts.hidden_vars(csrf_token)} + ${self.hidden_vars(csrf_token)} % if (report_success or session_expired) and last_key: -<%doc> - Copyright (C) 2015, 2020, 2021, 2024 The Meme Factory, Inc. - http://www.karlpinc.com/ - - This file is part of PGWUI_Common. - - This program is free software: you can redistribute it and/or - modify it under the terms of the GNU Affero General Public License - as published by the Free Software Foundation, either version 3 of - the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public - License along with this program. If not, see - . - - Template library of utilities for forms that authenticate a user and - accesses a db. - - Karl O. Pinc - - This template uses the following variables in it's context: - havecreds Already logged in - user - - -<%def name="hidden_vars(csrf_token)"> - - - % if db_changed is not None and db_changed is not UNDEFINED: - <%doc>This is a hack. It should be fixed so that only double-upload - detecting forms unconditionally generate this element. - - % endif - - -<%def name="user_row(tab_index, havecreds, user)"> - - - - - - % if havecreds: - ${user} - % else: - - % endif - <% tab_index.inc() %> - - - - -<%def name="password_row(tab_index, havecreds)"> - % if not havecreds: - - - - - - - - - <% tab_index.inc() %> - % endif - -- 2.34.1